﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

namespace Chromos.Map
{
    class MapReader
    {
        private string mapFileName;

        public MapReader(String mapFileName)
        {
            this.mapFileName = mapFileName;
        }

        public List<char[]> GetMapData()
        {
            TextReader tr = new StreamReader(this.mapFileName);

            // Initialize with a capacity of 20 so we don't have to resize array for at most 20 rows
            List<char[]> map = new List<char[]>(20);

            string line;
            while ((line = tr.ReadLine()) != null)
            {
                // Strip white space, and then convert the line to a char array.
                line.Replace(" ", "");
                map.Add(line.ToCharArray());
            }

            return map;
        }
    }
}
